package com.taobushi.controller;

import com.taobushi.entity.User;
import com.taobushi.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    UserMapper userMapper;
    @RequestMapping("getUserList")
    public List<User> getUserList(){
        return userMapper.selectList(null);
    }

    @PostMapping("insertUser")
    public List<User> insertUser(@RequestBody User user){
        userMapper.insert(user);
        return userMapper.selectList(null);
    }
}
